﻿var IndexCtrl = (function () {
	var that;
	var obj = function () {
		that = this;
	};

	obj.prototype = {
		ctrl: function ($scope, $http) {
			that.$scope = $scope;
			that.$http = $http;

			that.$scope.curTplName = "folder";
			that.$scope.redirect = that.redirect;
			that.$scope.showChildPage = that.showChildPage;
			that.$scope.toPaizhao = that.toPaizhao;

			that.first();
		},
		
		toPaizhao: function () {
			that.showChildPage('pages/publish.html');
		},

		first: function () {
			var div = document.createElement("div");
			div.className = "folderTishi";
			div.addEventListener("click", function () {
				document.body.removeChild(this);
			}, false);
			document.body.appendChild(div);
		},

		redirect: function (tplName) {
			if (tplName == that.$scope.curTplName) return;

			that.$scope.curTplName = tplName;
		},

		showChildPage: function (src) {
			Util.showChildPage(src);
		}
	};

	return new obj();
})();